package com.example.netty.tcp.message;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;

public class ConfigurationQueryResponse extends BaseMessage {
    public ConfigurationQueryResponse() {
        setMsgType(211); // 配置查询响应类型
    }

    @JsonProperty("result")
    private int result; // 1=成功, 0=失败

    @JsonProperty("resultList")
    private List<Result> resultList = new ArrayList<>();

    public void addResult(String signalId, String value) {
        Result resultItem = new Result();
        resultItem.setId(signalId);
        resultItem.setValue(value);
        resultList.add(resultItem);
    }

    public int getResult() {
        return result;
    }

    public void setResult(int result) {
        this.result = result;
    }

    public List<Result> getResultList() {
        return resultList;
    }

    public static class Result {
        @JsonProperty("id")
        private String id;
        @JsonProperty("value")
        private String value;

        public String getId() {
            return id;
        }

        public String getValue() {
            return value;
        }

        public void setId(String id) {
            this.id = id;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }
}
